<?php
	require("../../DBops.php");
	session_start();

	if(isset($_POST['delete_teams']))
	{
		$arry = explode("__",$_POST['delete_teams']);
		$con = connect("localhost", "root", "", "lab");
		
		foreach($arry as $ID)
		{
			$sql = "select * from projecteam where ID = '".$ID."'";
			$result = mysql_query($sql, $con);
			$row = mysql_fetch_array($result);
			$sql = "insert into projecteam_history values(".$row['ID'].",'".$row['name']."','".$row['introduction']."')";
			mysql_query($sql, $con);
			$sql = "delete from projecteam where ID = '".$ID."'";
			mysql_query($sql, $con);
		}
		
		echo "<script>history.back(-1);</script>";
	}
?>